package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.product.model.BaseTrademark;
import com.atguigu.gmall.product.mapper.BaseTrademarkMapper;
import com.atguigu.gmall.product.service.BaseTrademarkService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 品牌表 业务实现类
 *
 * @author atguigu
 * @since 2023-08-30
 */
@Service
public class BaseTrademarkServiceImpl extends ServiceImpl<BaseTrademarkMapper, BaseTrademark> implements BaseTrademarkService {

    /**
     * 分页查询所有品牌
     *
     * @param pageInfo
     * @return
     */
    @Override
    public Page<BaseTrademark> getTrademarkByPage(Page<BaseTrademark> pageInfo) {
        //1.构建条件对象
        LambdaQueryWrapper<BaseTrademark> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(BaseTrademark::getId, BaseTrademark::getLogoUrl, BaseTrademark::getTmName);

        //2.执行分页查询 (必须配置过MP分页拦截器)
        return this.page(pageInfo, queryWrapper);
    }
}
